package su.choco.queuing.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import su.choco.queuing.exception.MyException;

@Controller
@RequestMapping("/hello")
public class HelloController {
    @RequestMapping("/")
    public String index(ModelMap map) {
        // Add a attribute
        map.addAttribute("host", "http://changeword.com");

        // return template name, map to src/main/resources/templates/index.html
        return "index";
    }

    @RequestMapping("/json")
    public String json() throws MyException {
        throw new MyException("发生错误2");
    }
}
